<?php
	include_once("connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Free Hotel Website Template - designed by TemplateMonster</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="This is a wonderful homepage of the Free Hotel Website Template provided by TemplateMonster."/>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function formValidator(){
	// Make quick references to our fields
	var cekin= document.getElementById('cekin');
	var cekout= document.getElementById('cekout');
	
	// Check each input in the order that it appears in the form!
	if(notEmpty(checkin, "Masukkan tanggal check-in")){
		if(isDate(checkin, "Format tanggal yyyy-mm-dd")) {
			if(notEmpty(checkout, "Masukkan tanggal check-out")){
				if(isDate(checkout, "Format tanggal yyyy-mm-dd")) {
					return true;
				}
			}
		}
	}
	return false;
}

function notEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function isDate(elem, helperMsg){
	var dateExp =/^[0-9]{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])+$/;
	if(elem.value.match(dateExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

</script>
</head>
<body id="page1" onload="new ElementMaxHeight();">
<div id="main">
<!-- header -->
	<div id="header">
		<div class="row-1">
			<div class="wrapper">
				<div class="logo">
					<h1><a href="index.html">Indonesian Hotels</a></h1>
					<em>Hotel</em>
					<strong>True Luxury</strong>
				</div>
				
			</div>
		</div>
		<div class="row-2">
	 		<div class="indent">
<!-- header-box begin -->
				<div class="header-box">
					<div class="inner">
						<ul class="nav">
					 		<li><a href="index.php">Home page</a></li>
							<li><a href="#" class="current">Room and Rates</a>
							<ul>
								<li><a href="indo1.php" target="_self">Indonesian Hotels 1</a></li>
								<li><a href="indo2.php" target="_self">Indonesian Hotels 2</a></li>
								<li><a href="indo3.php" target="_self">Indonesian Hotels 3</a></li>
								<li><a href="indo4.php" target="_self">Indonesian Hotels 4</a></li>
								<li><a href="indo5.php" target="_self">Indonesian Hotels 5</a></li>
								<li><a href="indo6.php" target="_self">Indonesian Hotels 6</a></li>
								<li><a href="indo7.php" target="_self">Indonesian Hotels 7</a></li>
							</ul>
							
							</li>
							<li><a href="booking.php">Booking</a>
							<ul>
								<li><a href="bookindo1.php" target="_self">Indonesian Hotels 1</a></li>
								<li><a href="bookindo2.php" target="_self">Indonesian Hotels 2</a></li>
								<li><a href="bookindo3.php" target="_self">Indonesian Hotels 3</a></li>
								<li><a href="bookindo4.php" target="_self">Indonesian Hotels 4</a></li>
								<li><a href="bookindo5.php" target="_self">Indonesian Hotels 5</a></li>
								<li><a href="bookindo6.php" target="_self">Indonesian Hotels 6</a></li>
								<li><a href="bookindo7.php" target="_self">Indonesian Hotels 7</a></li>
							</ul>

							</li>
							<li><a href="location.php">Location</a></li>
							<li><a href="gallery.php">Gallery</a></li>
							<li><a href="contact.php">Contact Us</a></li>
						</ul>
					</div>
				</div>
<!-- header-box end -->
			</div>
		</div>
	</div><div class="ic">Lovely Flash templates from TemplateMonster!</div>
<!-- content -->
	<div id="content">
		<div class="wrapper">
			<div class="aside maxheight">
<!-- box begin -->
				<div class="box maxheight">
					<div class="inner">
						<?php
						//include_once("form_reservasi.php");
						?>
					</div>
				</div>
<!-- box end -->
			</div>
			<div id="content">
				<div class="indent">
					<h2>Indonesian Hotels 1</h2>
					<?php
					$cekin = $_POST['checkin'];
					$cekout = $_POST['checkout'];
					$idhotel=$_POST['id'];
					$sql = "select view_ref_biaya.id_jenis_kamar,view_ref_biaya.jenis_kamar,count(no_kamar),kapasitas,ppn, harga_hari from kamar_kosong,view_ref_biaya where kamar_kosong.id_hotel=1 and kamar_kosong.id_hotel=view_ref_biaya.id_hotel and kamar_kosong.id_jenis_kamar=view_ref_biaya.id_jenis_kamar group by kamar_kosong.id_jenis_kamar";
					$exe = mysql_query($sql);
					
					?>
					<h3>1 Select Rooms</h3>
					<p>Check-in : <?php echo $cekin; ?></p><p>Check-out : <?php echo $cekout; ?></p>
					<form action = "selectroom2.php" method="post" name="formdate" id="formdate" onsubmit='return formValidator()'>
						<table border="1">
						<tr>
							<td width="15%" align="center">available rooms</td>
							<td width="15%" align="center">capacity</td>
							<td width="20%" align="center">ppn</td>
							<td width="25%" align="center">cost per room</td>
							<td width="20%" align="center">number of rooms</td>
						</tr>
						<?php
							$idx = 0;
							while($list=mysql_fetch_array($exe)){
						?>
						<tr>
							<td width="120"><?php echo $list[1];?></td>
							<input type="hidden" name="<?php echo "id_jenis_".$idx;?>" value="<?php echo $list[0];?>">
							<input type="hidden" name="<?php echo "jenis_".$idx;?>" value="<?php echo $list[1];?>">
							<td width="120"><?php echo $list[2];?></td>
							<td width="100"><?php echo $list[3];?></td>
							<td width="100"><?php echo $list[4];?></td>
							<td>
							<select name=<?php echo "qty_room_" . $idx; ?>>
							<?php
							for($i=0;$i<=$list[2];$i++){
								echo "<option value=$i>$i</option>";
							}
							?>
							
						</select>
						</td>
						</tr>
						
						<?php
							$idx++;							
							}
						?>
						<tr>
							<td colspan="4">&nbsp;</td>
							<td>
							<input type="hidden" name="cekin" id="cekin" value="<?php echo $cekin ?>"/>
							<input type="hidden" name="cekout" id="cekout" value="<?php echo $cekout ?>"/>
							<input type="hidden" name="idhotel" id="idhotel" value="<?php echo $idhotel ?>"/>
							<input type="submit" name="reserve" id="button" value="reserve"/>
							</td>
						</tr>
						<?php	
							mysql_close($con);
						?>
						</table>
					</form>
				</div>
			</div>

		</div>
	</div>
	
<!-- footer -->
	<div id="footer">
  		<ul class="nav">
	 		<li><a href="index.html">Home</a>|</li>
			<li><a href="services.html">Services</a>|</li>
			<li><a href="gallery.html">Gallery</a>|</li>
			<li><a href="restaurant.html">Restaurant</a>|</li>
			<li><a href="testimonials.html">Testimonials</a>|</li>
			<li><a href="booking.html">Booking</a></li>
		</ul>
		<div class="wrapper">
			<div class="fleft">Copyright (c) 2012 Indonesian Hotels</div>
		</div>
	</div>
</div>
</body>
</html>